.class public Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;
.super Lcom/teewoo/app/bus/inface/BaseActivity;
.source "SearchByLineResultActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$MyAdapter;
    }
.end annotation


# instance fields
.field private keyWord:Ljava/lang/String;

.field private lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

.field private linesListView:Landroid/widget/ListView;

.field private list:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/teewoo/app/bus/model/Line;",
            ">;"
        }
    .end annotation
.end field

.field private listener:Landroid/content/DialogInterface$OnClickListener;

.field private proBar:Landroid/widget/ProgressBar;

.field private titleView:Landroid/widget/TextView;


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 34
    invoke-direct {p0}, Lcom/teewoo/app/bus/inface/BaseActivity;-><init>()V

    .line 169
    new-instance v0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$1;

    invoke-direct {v0, p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$1;-><init>(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)V

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->listener:Landroid/content/DialogInterface$OnClickListener;

    .line 34
    return-void
.end method

.method static synthetic access$0(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)Ljava/util/List;
    .locals 1
    .parameter

    .prologue
    .line 37
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->list:Ljava/util/List;

    return-object v0
.end method

.method static synthetic access$1(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)[I
    .locals 1
    .parameter

    .prologue
    .line 34
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->item_background:[I

    return-object v0
.end method

.method static synthetic access$2(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 39
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->keyWord:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$3(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)V
    .locals 0
    .parameter

    .prologue
    .line 78
    invoke-direct {p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->dataRequestAndProgress()V

    return-void
.end method

.method static synthetic access$4(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)Landroid/widget/TextView;
    .locals 1
    .parameter

    .prologue
    .line 36
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->titleView:Landroid/widget/TextView;

    return-object v0
.end method

.method static synthetic access$5(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)Landroid/widget/ProgressBar;
    .locals 1
    .parameter

    .prologue
    .line 38
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->proBar:Landroid/widget/ProgressBar;

    return-object v0
.end method

.method static synthetic access$6(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)Landroid/widget/ListView;
    .locals 1
    .parameter

    .prologue
    .line 35
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->linesListView:Landroid/widget/ListView;

    return-object v0
.end method

.method static synthetic access$7(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;Ljava/lang/String;I)V
    .locals 0
    .parameter
    .parameter
    .parameter

    .prologue
    .line 147
    invoke-direct {p0, p1, p2}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->saveHistoryRecord(Ljava/lang/String;I)V

    return-void
.end method

.method static synthetic access$8(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)Landroid/content/DialogInterface$OnClickListener;
    .locals 1
    .parameter

    .prologue
    .line 169
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->listener:Landroid/content/DialogInterface$OnClickListener;

    return-object v0
.end method

.method private dataRequestAndProgress()V
    .locals 4

    .prologue
    .line 80
    invoke-virtual {p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    .line 81
    .local v1, intent:Landroid/content/Intent;
    const-string v2, "com.teewoo.app.bus.search.line"

    invoke-virtual {v1, v2}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->keyWord:Ljava/lang/String;

    .line 82
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->keyWord:Ljava/lang/String;

    if-eqz v2, :cond_0

    .line 85
    :try_start_0
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->keyWord:Ljava/lang/String;

    invoke-static {v2}, Lcom/teewoo/app/bus/util/SearchUtil;->getLineByKeyWord(Ljava/lang/String;)Ljava/util/List;

    move-result-object v2

    iput-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->list:Ljava/util/List;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 90
    :goto_0
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->list:Ljava/util/List;

    if-eqz v2, :cond_2

    .line 91
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->list:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v2

    if-lez v2, :cond_1

    .line 92
    new-instance v2, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$4;

    invoke-direct {v2, p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$4;-><init>(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)V

    invoke-virtual {p0, v2}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 145
    :cond_0
    :goto_1
    return-void

    .line 86
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 87
    .local v0, e:Ljava/lang/Exception;
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->context:Landroid/content/Context;

    const v3, 0x7f080017

    invoke-static {v2, v3}, Lcom/teewoo/app/bus/util/ToastUtil;->showToastCenter(Landroid/content/Context;I)V

    .line 88
    const/4 v2, 0x0

    iput-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->list:Ljava/util/List;

    goto :goto_0

    .line 121
    .end local v0           #e:Ljava/lang/Exception;
    :cond_1
    new-instance v2, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$5;

    invoke-direct {v2, p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$5;-><init>(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)V

    invoke-virtual {p0, v2}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->runOnUiThread(Ljava/lang/Runnable;)V

    goto :goto_1

    .line 134
    :cond_2
    new-instance v2, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$6;

    invoke-direct {v2, p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$6;-><init>(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)V

    invoke-virtual {p0, v2}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->runOnUiThread(Ljava/lang/Runnable;)V

    goto :goto_1
.end method

.method private saveHistoryRecord(Ljava/lang/String;I)V
    .locals 8
    .parameter "keyWord"
    .parameter "lineId"

    .prologue
    .line 150
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    invoke-virtual {v4, p1}, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;->findByKeyword(Ljava/lang/String;)Lcom/teewoo/app/bus/model/history/LineHistory;

    move-result-object v2

    .line 151
    .local v2, lHis:Lcom/teewoo/app/bus/model/history/LineHistory;
    if-eqz v2, :cond_0

    .line 153
    invoke-static {}, Lcom/teewoo/app/bus/util/Utils;->getLocCurrentTime()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v2, v4}, Lcom/teewoo/app/bus/model/history/LineHistory;->setSearchTime(Ljava/lang/String;)V

    .line 154
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    invoke-virtual {v4, v2}, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;->update(Lcom/teewoo/app/bus/model/history/LineHistory;)V

    .line 167
    :goto_0
    return-void

    .line 157
    :cond_0
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    invoke-virtual {v4}, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;->getCount()J

    move-result-wide v0

    .line 158
    .local v0, count:J
    const-wide/16 v4, 0x5

    cmp-long v4, v0, v4

    if-ltz v4, :cond_1

    .line 160
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    invoke-virtual {v4}, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;->getAll()Ljava/util/List;

    move-result-object v3

    .line 162
    .local v3, list:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/history/LineHistory;>;"
    iget-object v5, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v4

    const/4 v6, 0x1

    sub-int/2addr v4, v6

    invoke-interface {v3, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/teewoo/app/bus/model/history/LineHistory;

    invoke-virtual {v4}, Lcom/teewoo/app/bus/model/history/LineHistory;->getId()Ljava/lang/Integer;

    move-result-object v4

    invoke-virtual {v5, v4}, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;->delete(Ljava/lang/Integer;)V

    .line 165
    .end local v3           #list:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/history/LineHistory;>;"
    :cond_1
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    new-instance v5, Lcom/teewoo/app/bus/model/history/LineHistory;

    invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    invoke-static {}, Lcom/teewoo/app/bus/util/Utils;->getLocCurrentTime()Ljava/lang/String;

    move-result-object v7

    invoke-direct {v5, p1, v6, v7}, Lcom/teewoo/app/bus/model/history/LineHistory;-><init>(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;)V

    invoke-virtual {v4, v5}, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;->save(Lcom/teewoo/app/bus/model/history/LineHistory;)V

    goto :goto_0
.end method


# virtual methods
.method public initialUI()V
    .locals 2

    .prologue
    .line 45
    invoke-super {p0}, Lcom/teewoo/app/bus/inface/BaseActivity;->initialUI()V

    .line 46
    iput-object p0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->context:Landroid/content/Context;

    .line 47
    sget-object v0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->cityView:Landroid/widget/TextView;

    sget-object v1, Lcom/teewoo/app/bus/ui/Home4StaticMap;->currentCityAddress:Ljava/lang/String;

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 48
    const v0, 0x7f0a00a2

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->titleView:Landroid/widget/TextView;

    .line 49
    const v0, 0x7f0a006a

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->linesListView:Landroid/widget/ListView;

    .line 50
    const v0, 0x7f0a002a

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ProgressBar;

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->proBar:Landroid/widget/ProgressBar;

    .line 51
    new-instance v0, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    invoke-direct {v0, p0}, Lcom/teewoo/app/bus/manager/history/LineHistoryManager;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->lineHistoryManager:Lcom/teewoo/app/bus/manager/history/LineHistoryManager;

    .line 52
    return-void
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 2
    .parameter "savedInstanceState"

    .prologue
    .line 56
    invoke-super {p0, p1}, Lcom/teewoo/app/bus/inface/BaseActivity;->onCreate(Landroid/os/Bundle;)V

    .line 57
    const v0, 0x7f03001e

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->setContentView(I)V

    .line 60
    invoke-virtual {p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->initialUI()V

    .line 61
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;->back:Landroid/view/View;

    new-instance v1, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$2;

    invoke-direct {v1, p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$2;-><init>(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 68
    new-instance v0, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$3;

    invoke-direct {v0, p0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$3;-><init>(Lcom/teewoo/app/bus/ui/SearchByLineResultActivity;)V

    .line 72
    invoke-virtual {v0}, Lcom/teewoo/app/bus/ui/SearchByLineResultActivity$3;->start()V

    .line 73
    return-void
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 1
    .parameter "menu"

    .prologue
    .line 180
    const/4 v0, 0x0

    return v0
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 1
    .parameter "item"

    .prologue
    .line 185
    const/4 v0, 0x0

    return v0
.end method
